 //******************************************************************
 // MonetaryCoinTest.java                      Author:20172323wyh
 //
 // 实例化MonetaryCoin对象，并计算若干个MonetaryCoin对象的和。
 //******************************************************************
 
 public class MonetaryCoinTest
 {
    public static void main(String[] args)
    {
        MonetaryCoin[] coins = new MonetaryCoin[5];

        coins[0] = new MonetaryCoin();
        coins[1] = new MonetaryCoin();
        coins[2] = new MonetaryCoin();
        coins[3] = new MonetaryCoin();
        coins[4] = new MonetaryCoin();

        int sum = 0;
        for (int x = 0; x < coins.length; x++)
        {
            System.out.println("第" + (x + 1) + "次抛硬币的值:" + coins[x].getFacevalue());
            sum += coins[x].getFacevalue();
        }

        System.out.println("硬币面值总额:" + sum);
    }
 }
